<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>lesson 14</title>
  <script src="https://unpkg.com/vue@next"></script>
</head>

<body>
  <div id="root"></div>
</body>
<script>

  const app = Vue.createApp({
    //每个组件的数据互不影响
    template: '<div><demo></demo> <demo></demo> <demo></demo></div>'
  })
  app.component('demo', {
    data() {
      return {
        counter: 0
      }
    },
    template: `<div><button @click="counter+=1">点击{{counter}}</button> </div> `
  })

  const vm = app.mount('#root');
</script>

</html>